/**
 * 
 */
package org.lightcommons.template.freemarker;

import java.io.Writer;
import java.util.Locale;

import org.lightcommons.template.AbstractTemplate;
import org.lightcommons.util.Assert;

import freemarker.template.Template;

/**
 * @author gl
 * @since Jun 15, 2008
 */
public class FreeMakerFacade extends AbstractTemplate {
	private final Template rawTemplate;


	/**
	 * @param rawTemplate
	 */
	public FreeMakerFacade(Template rawTemplate) {
		super();
		Assert.notNull(rawTemplate,"rawTemplate must not be null");

		this.rawTemplate = rawTemplate;
	}


	/* (non-Javadoc)
	 * @see org.lightcommons.template.AbstractTemplate#renderUnsafe(java.lang.Object, java.io.Writer)
	 */
	@Override
	public void renderUnsafe(Object rootMap, Writer writer,Locale locale) throws Exception {
		rawTemplate.process(rootMap, writer);
	}
}
